package sdk.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import sdk.service.EmpManager;
import sdk.service.RewAndPunManager;
import util.Page;

import model.Dept;
import model.Duty;
import model.Emp;
import model.EmpTransfer;
import model.RewAndPun;
import zym.service.TansferMag;
import dao.DeptDAO;
import dao.DutyDAO;
import dao.EmpDAO;
import dao.impl.DeptDAOImpl;
import dao.impl.DutyDAOImpl;
import dao.impl.EmpDAOImpl;

public class GetRewAndPunServlet extends HttpServlet {

	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		this.doPost(request, response);
	
	}


	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		response.setContentType("text/html");
		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		
		int pageNo=1;
		int pageSize=2;
		try{
			if(request.getParameter("pageNo")!=null)
			{
				pageNo=Integer.parseInt(request.getParameter("pageNo"));
			}
			if(request.getParameter("pageSize")!=null)
			{
				pageSize=Integer.parseInt(request.getParameter("pageSize"));
				request.getSession().setAttribute("pageSize", pageSize);
			}
			if(request.getSession().getAttribute("pageSize")!=null)
			{
				pageSize=(Integer) request.getSession().getAttribute("pageSize");
			}
		}catch(Exception e)
		{
			e.printStackTrace();
		}
		Page<RewAndPun> page=new RewAndPunManager().getAll(pageNo, pageSize);
		// 计算起始记录跟结束记录
		request.setAttribute("page", page);
		request.getRequestDispatcher("/Dossier/Rewandpun.jsp").forward(request, response);
	}

}
